﻿using EPiServer;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;

namespace OpenWaves.ActivityFeed.EPiServer
{
    [InitializableModule]
    public class ActivityFeedEPiServerIntegrationModule : IInitializableModule
    {
        public void Initialize(InitializationEngine context)
        {
            DataFactory.Instance.PublishedPage += (sender, args) =>
                                                      {
                                                          var connector = ServiceLocator.Resolve<IActivityFeedEPiServerConnector>();
                                                          connector.OnPagePublished(args.Page);
                                                      };
        }

        public void Uninitialize(InitializationEngine context)
        {
        }

        public void Preload(string[] parameters)
        {
        }
    }
}